package com.zhx.real.core.constant;

/**
 *describe: security 登录接口
 *
 *@author zhanghaixuan
 *@date 2019/02/22
 **/
public interface SecurityConstants {


	/**
	 * {bcrypt} 加密的特征码
	 */
	String BCRYPT = "{bcrypt}";
	/**
	 * base_oauth_client_details 表的字段，不包括client_id、client_secret
	 */
	String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
			+ "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
			+ "refresh_token_validity, additional_information, autoapprove";

	/**
	 * JdbcClientDetailsService 查询语句
	 */
	String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS
			+ " from real_oauth_client_details";

	/**
	 * 默认的查询语句
	 */
	String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";

	/**
	 * 按条件client_id 查询
	 */
	String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";


	/**
	 * OAUTH URL
	 */
	String OAUTH_TOKEN_URL = "/oauth/token";

	/**
	 * CHECK URL
	 */
	String CHECK_TOKEN_URL = "/oauth/check_token";

	/**
	 * 手机号登录URL
	 */
	String SMS_TOKEN_URL = "/mobile/token/sms";



	/**
	 * oauth 客户端信息
	 */
	String CLIENT_DETAILS_KEY = "com.zhx.real:client:details";

	/**
	 * 资源服务器默认bean名称
	 */
	String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";

	/**
	 * 刷新
	 */
	String REFRESH_TOKEN = "refresh_token";
	/**
	 * 当请求需要身份认证的时候,默认跳转的url
	 * 已废弃: by zhx
	 * 将直接返回401
	 */
	String DEFAULT_UNAUTHENRICATION_URL = "/v1/authentication/require";

	/**
	 * 默认的手机验证码请求的登录的url
	 * @param phone
	 * @param verifycode
	 * @header service
	 */
	String DEFAULT_LOGIN_PROCESSING_URL_MOBILE ="/v1/authentication/mobile";

	/**
	 * 默认的OPENID登录请求处理url
	 */
	String DEFAULT_LOGIN_PROCESSING_URL_OPENID = "/v1/authentication/openid";

	/**
	 * 默认的用户名密码登录请求的url
	 * @param username
	 * @param password
	 * @header service
	 */
	String NORMAL_LOGIN_PROCESSING_URL_FORM ="/v1/authentication/login";
	/**
	 * 用户名密码登录和图形验证码请求的url
	 * @param username
	 * @param password
	 * @param authcode
	 * @param verifycode
	 * @header service
	 */
	String NORMAL_LOGIN_PROCESSING_URL_VERIFY ="/v1/authentication/verifycode";

	/**
	 * 客户端模式
	 */
	String CLIENT_CREDENTIALS = "client_credentials";

	/**
	 * 验证码有效期
	 */
	int CODE_TIME = 300;


	/**
	 * 内部
	 */
	String FROM_IN = "Y";

	/**
	 * 标志
	 */
	String FROM = "from";
}
